<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>js_修饰</title>

	<script>
		var count = 0 ;
		function $(id){return document.getElementById(id);}
		window.onload = function (){
			$("div1").style.width = 200+'px';
			$("div1").style.height = 200+'px';
			$("div1").style.border = '1px solid red';
			$("div1").style.borderRadius = '100px';
			$("div1").style.background = 'lightcyan';



			$("but").addEventListener("click",function (){
				count++;
				if(count%2!=0){
					//实现隐藏
					$("div1").className ="yin";
				}else {
					//实现显示
					$("div1").className = "xian";
				}
			})
		}

	</script>

	<style>
		.xian{display: block;}
		.yin{display: none;}
	</style>

</head>
<body>
	<button id="but">显示/隐藏</button>
	<div id="div1"></div>

</body>
</html>